#!/bin/sh
# run in mirror
svnroot='/opt/svnroot/wl'
for repos in `ls $svnroot`
do
	if [ ! -d $svnroot/$repos/db ];then
		continue;
	fi
	if [ ! -d $svnroot/$repos/conf ];then
		continue;
	fi
	## source check
	size=`echo file://$svnroot/$repos|wc -c`
	size=$(($size-1))
	sed  -i "7,8s/V .*$/V $size/" $svnroot/$repos/db/revprops/0/0 

	## sha check
	sha_size=`sed -n '12,12p' $svnroot/$repos/db/revprops/0/0|wc -c`
	sha_size=$(($sha_size-1))
	sed  -i "11,11s/V .*$/V $sha_size/" $svnroot/$repos/db/revprops/0/0 

	## version check
	sha_size=`sed -n '16,16p' $svnroot/$repos/db/revprops/0/0|wc -c`
	sha_size=$(($sha_size-1))
	sed  -i "15,15s/V .*$/V $sha_size/" $svnroot/$repos/db/revprops/0/0 

	sed -i  "8,8s/.*$/file:\/\/\/opt\/svnroot\/wl\/"$repos"/" $svnroot/$repos/db/revprops/0/0 
	if [  $? == 0 ];then
		echo "$repos ok!"
	else
		echo "$repos replace failed"
	fi
done 
